package com.qc.bug.Util;

import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.HtmlEmail;

public class sendEmailUtil {
	
	
//	public static void main(String[] args) {
//		sendEmailUtil.sendEmail("kuqi_jl@sina.com");
//	}
	
	public static void sendEmail(String forEmail){
		
		HtmlEmail email = new HtmlEmail();
		email.setDebug(true);
		email.setHostName("smtp.sina.com");
		email.setAuthentication("mjjl_kq@sina.com", "gemin111");
		email.setCharset("utf-8");
		
		try {
			// 设置收件人信息[收件人邮箱，收件人姓名，编码格式]
			email.addTo(forEmail, forEmail, "utf-8");
			// 设置发件人信息[发件人邮箱，发件人姓名，编码格式]
			email.setFrom("mjjl_kq@sina.com", "mjjl_kq@sina.com", "utf-8");
			// 设置主题
			email.setSubject("myBug系统邮箱验证");
			// 设置html内容
			email.setHtmlMsg("<a href='http://localhost:8080/MyBugs/sendEmailContr/updateEmail'>点击此处进行邮箱验证</a>");
			// 发送邮件
			email.send();
		} catch (EmailException e) {
			
			e.printStackTrace();
		}
		


	}

	
}
